package com.example.demo.util;

import org.apache.commons.mail.SimpleEmail;

import java.security.SecureRandom;
import java.util.Random;

public class WarningEmailUtil {
    public void sendEmail(String fromEmail,String toEmail,String info){
        SimpleEmail se =new SimpleEmail();
        se.setHostName("smtp.qq.com");
        se.setSmtpPort(465);
        se.setSSLOnConnect(true);
        se.setAuthentication(fromEmail, "jmdxpzqopsxdddhi");
        try {
            se.addTo(toEmail);
            se.setFrom(fromEmail);
            se.setSubject("Warning info");
            se.setMsg("Your info is："+info);
            se.send();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
